import {getToken,setToken,removeToken} from '@/utils/auth'

const state ={
  token:getToken() // 取token
}
const mutations ={
  setToken(state,token){
    state.token = token;
    setToken(token)
  },
  // 删除token
  removeToken(){
    state.token =null;
    removeToken()
  }
}
const actions ={
  login(context,data){
    console.log(data);
    context.commit('setToken','123456');
  }
}

export default{
  namespaced:true, // 开启命名空间
  state,
  mutations,
  actions
}
